/* include/kernel/init.h 
 * 
 * This file is part of xnix. 
 * 
 * XNIX is free software: you can redistribute it and/or modify 
 * it under the terms of the GNU General Public License as published by 
 * the Free Software Foundation, either version 3 of the License, or 
 * (at your option) any later version. 
 * 
 * XNIX is distributed in the hope that it will be useful, 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
 * GNU General Public License for more details. 
 * 
 * You should have received a copy of the GNU General Public License 
 * along with XNIX. If not, see <https://www.gnu.org/licenses/>
 */ 




#ifndef __INIT_H
#define __INIT_H


#ifndef __ASSEMBLER__

#include <sys/types.h>


#ifndef NULL

#define NULL ((void *) 0)

#endif

/* defines in kernel.lds */

extern void *_init_call_arch, *_init_call_kernel, *_init_call_modules;
extern void *_einit_call_arch, *_einit_call_kernel, *_einit_call_modules;

#define arch_init(fn) 	\
	void *__initcall1_##fn __attribute__ ((__section__ (".initcalls.arch"))) = fn;

#define kernel_init(fn)	\
	void *__initcall2_##fn __attribute__ ((__section__ (".initcalls.kernel"))) = fn;


#define __init		__attribute__((__section__(".init.text")))

#define ARRAYSIZE(arr) 	(sizeof(arr) / sizeof(arr[0]))

#endif

#endif

